package com.robot.mvvm.ui.main

import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.robot.mvvm.R
import com.robot.mvvm.databinding.AppFragmentHomeBinding
import com.robot.mvvm.vm.main.HomeFragmentViewModel
import com.robot.base.base.activity.GLBaseFragment
import com.robot.mvvm.ui.main.adapter.InformationAdapter
import me.goldze.mvvmhabit.BR

/**
 * 设备
 */
class HomeFragment : GLBaseFragment<AppFragmentHomeBinding, HomeFragmentViewModel>() {
    var mInformationAdapter: InformationAdapter? = null
    override fun initContentView(
        inflater: LayoutInflater?,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): Int = R.layout.app_fragment_home

    override fun initVariableId(): Int = BR.viewModel

    override fun initComponents() {

        initAdapter()
    }

    private fun initAdapter() {
        mInformationAdapter = InformationAdapter()
        binding.mRvInformation.apply {
            layoutManager = LinearLayoutManager(requireContext())
            adapter = mInformationAdapter
        }

        mInformationAdapter?.setNewInstance(arrayListOf("", "", "", "", "", "", "", "", ""))
    }
}